import fetch from 'utils/fetch';
import Cookies from 'js-cookie';


export function getList() {
  const getParams = new URLSearchParams();
  getParams.append('operatorid', Cookies.get('uid'));
  getParams.append('lastlogincode', Cookies.get('lastlogincode'));
  return fetch({
    url: '/trc-service-enterprise/enterpriseQualifications/queryAllEnterpriseQualifications',
    params: getParams,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  });
}

export function saveQualificationInfo(requestParams) {
  const operatorid = Cookies.get('uid');
  const lastlogincode = Cookies.get('lastlogincode')
  Object.assign(requestParams, { operatorid, lastlogincode });
  return fetch({
    url: '/trc-service-enterprise/enterpriseQualifications/addEnterpriseQualifications',
    method: 'post',
    data: JSON.stringify(requestParams),
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 编辑企业资质
export function updateQualificationInfo(requestParams) {
  const operatorid = Cookies.get('uid');
  const lastlogincode = Cookies.get('lastlogincode')
  Object.assign(requestParams, { operatorid, lastlogincode });
  return fetch({
    url: '/trc-service-enterprise/enterpriseQualifications/updateEnterpriseQualifications',
    method: 'post',
    data: JSON.stringify(requestParams),
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 启用、停用企业资质
export function updateQualificationStatus(requestParams) {
  const operatorid = Cookies.get('uid');
  const lastlogincode = Cookies.get('lastlogincode')
  Object.assign(requestParams, { operatorid, lastlogincode });
  return fetch({
    url: '/trc-service-enterprise/enterpriseQualifications/enableOrDisableEnterpriseQualifications',
    method: 'post',
    data: JSON.stringify(requestParams),
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 删除企业资质
export function deleteQualificationInfo(requestParams) {
  const operatorid = Cookies.get('uid');
  const lastlogincode = Cookies.get('lastlogincode')
  Object.assign(requestParams, { operatorid, lastlogincode });
  return fetch({
    url: '/trc-service-enterprise/enterpriseQualifications/deleteEnterpriseQualificationsById',
    method: 'post',
    data: JSON.stringify(requestParams),
    headers: {
      'Content-Type': 'application/json'
    }
  });
}